import { ENV_FIELD_MAPPING_REVERSE } from '@app-base/common/providers/userSettingProvider';
import { httpV3 } from '../httpV3';

export const httpSettingApi = {
  // 获取用户习惯详情
  getUserHabitDetail: () => httpV3.get(`/api/v3/userHabit/detailInfo`),
  // 保存用户习惯
  saveUserHabitDetail: (params: {
    cadType?: CmdSettingSpace.CadType;
    toolbarPosition?: 'top' | 'bottom';
    customConfig?: {
      pan: CmdSettingSpace.Operation;
      zoom: CmdSettingSpace.Operation;
      rotate: CmdSettingSpace.Operation;
    };
  }) => httpV3.post(`/api/v3/userHabit/saveOrUpdate`, params),
  // 获取命令详情
  getUserCmdConfigDetail: () =>
    httpV3.get(`/api/v3/nextCommandConfig/detailInfo`),
  // 保存用户习惯
  saveUserCmdConfigDetail: (params: Record<string, string[]>) =>
    httpV3.post(`/api/v3/nextCommandConfig/saveOrUpdate`, params),
  // 获取鼠标笔势详情
  getUserMouseGestureDetail: () =>
    httpV3.get(`/api/v3/mousePosture/detailInfo`),
  // 保存鼠标笔势详情
  saveUserMouseGestureDetail: (
    params: Record<keyof typeof ENV_FIELD_MAPPING_REVERSE, string[]> & {
      enableMouseGesture: boolean;
    },
  ) => httpV3.post(`/api/v3/mousePosture/saveOrUpdate`, params),
};
